package com.ifonly.ar.providers;

import com.alibaba.druid.pool.DruidDataSource;

import javax.sql.DataSource;

/**
 * @author ifonly
 * @version 1.0 2015-12-03 13:56
 * @since JDK 1.6
 */
public class DruidDataSourceProvider implements IDataSourceProvider {

    private String url;
    private String user;
    private String password;

    public DruidDataSourceProvider(String url, String user, String password) {
        this.url = url;
        this.user = user;
        this.password = password;
    }

    public DataSource getDataSource() {
        DruidDataSource ds = new DruidDataSource();
        ds.setUrl(url);
        ds.setUsername(user);
        ds.setPassword(password);
        return ds;
    }
}
